/*****************
* Ant Scriptdef/Frameworks/Js/Backbase/BCF routine for
* including Backbase Client Foundation into a project
*
* @version 0.1
* @author Arnoud ten Hoedt / Roonaan
*********************/
importClass(java.io.File);

var deps = project.createTask("ant4web.dependencies");
var depExtractDir = project.getProperty("ant4web.lib") + "/lib-ext/js/backbase";

deps.setDynamicAttribute("dir", depExtractDir);
deps.setDynamicAttribute("type", "http");
deps.setDynamicAttribute("url", "http://download.backbase.com/releases/Backbase_Client_Edition_4_4_0.zip");
deps.setDynamicAttribute("expand", "zip");
deps.setDynamicAttribute("expandbase", "web/backbase");

var sOptimized = attributes.get("optimized");

var bOptimized = sOptimized.matches(/true|yes|on|1/i);

var subDir = "4_4_0"; 

if(bOptimized) {
	subDir = "4_4_0_optimized";
} 

var fs = project.createDataType("fileset");
fs.setDir(new File(depExtractDir + "/" + subDir));
fs.setExcludes("ant.imported.log");
fs.setIncludes("**/*.*");

var cp = project.createTask("copy");
cp.setTodir(new File(attributes.get("dir")));
cp.addFileset(fs);
cp.perform();